home *** CD-ROM | disk | FTP | other *** search
/ Aminet 4 / Aminet 4 - November 1994.iso / aminet / dev / m2 / m2_part1.lha / modula / src / M2Lib.def < prev    next >
Text File  |  1994-07-30  |  2KB  |  47 lines

  1. DEFINITION FOR C MODULE M2Lib ;
  2.  
  3. FROM SYSTEM IMPORT ADDRESS, STRING ;
  4.  
  5. VAR (* The following variables are READ ONLY!! *)
  6.   wbStarted : BOOLEAN ;
  7.   wbMsg     : ADDRESS ; (* Startup message sent to us by workbench,      *)
  8.               (* Do not reply to it, as the DICE exit code will *)
  9.               (* do this at the correct time.              *)
  10.               (* wbMsg is only valid if wbStarted = TRUE      *)
  11.  
  12. (* following are only valid if wbStarted = FALSE (CLI startup) *)
  13.   argc : LONGINT ; (* # of cmd line arguments eg [m2c x.mod] = 2 arguments *)
  14.   argv : POINTER TO ARRAY (* 0..argc-1 *) OF STRING ;
  15.  
  16. PROCEDURE OpenLib( name : STRING ; version : LONGINT ) : ADDRESS ;
  17. (* Like the Exec version but the library is automatically closed at program   *)
  18. (* exit.                                      *)
  19.  
  20. PROCEDURE _ErrorReq( s1,s2 : STRING ) ;
  21. (* Displays an error requester with s1,s2 and then calls StdLib.exit(20)  *)
  22. (* dont pass NIL as either argument pass " " instead.              *)
  23.  
  24. PROCEDURE CheckStack( needBytes : LONGINT ) ;
  25. (* Checks that needBytes of space are avaiable on the stack.        *)
  26. (* calls _ErrorReq if there are not.                    *)
  27. (* Used for manual stack checking. Place calls to this procedure in    *)
  28. (* the recursive call paths of your program.                *)
  29. (* If the check fails then this function sets the stack to a safer    *)
  30. (* value before the _ErrorReq call.                    *)
  31. (* DO NOT use if youre program creates coroutines or Exec tasks        *)
  32.  
  33. (* Duplicated from StdLib.def *)
  34.  
  35. TYPE
  36.   IntProc = PROCEDURE( ) : LONGINT ;
  37.  
  38. PROCEDURE onbreak( ip : IntProc ) : IntProc ;
  39. PROCEDURE atexit( p : PROC ) ;
  40. PROCEDURE exit( n : LONGINT ) ;
  41.  
  42. PROCEDURE malloc( size : LONGINT ) : ADDRESS ;
  43. PROCEDURE free( a : ADDRESS ) ;
  44.  
  45. END M2Lib.
  46.  
  47.